package com.lagou.boot;

import com.lagou.client.RPCConsumer;
import com.lagou.service.IUserService;
import com.lagou.service.RpcRequest;

public class ConsumerBoot {

    //参数定义
    private static final String PROVIDER_NAME = "UserService#sayHello#";

    public static void main(String[] args) throws InterruptedException {

        //1.创建代理对象
        RPCConsumer rpcConsumer = new RPCConsumer();
        IUserService service = (IUserService) rpcConsumer.createProxy(IUserService.class, PROVIDER_NAME);



        //2.循环给服务器写数据
        while (true){
            Object[] objects = {'a','b','c','d'};
            Class[] classes = {Character.class};
            RpcRequest rpcRequest = new RpcRequest("requestId","className","methodName",classes,objects);
            System.out.println(service.RpcMessage(rpcRequest));
            Thread.sleep(2000);
        }

    }
}
